<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_外间距测试</title>
    <style>
        body {
            /*去掉body自带的8px外间距*/
            margin: 0;
        }
        * {
            /*设置所有元素的外边距为0*/
            margin: 0;
            /*设置所有元素的内边距为0*/
            padding: 0;
        }
        .fu>div{
            width: 100px;
            height: 100px;
            background-color: #ff0;
            border: 2px solid #f00;
            color: black;
            font-size: 25px;
            font-weight: bold;
        }
        .z1{
            margin-bottom: 50px;
            margin-top: 50px;
        }
        .z2{
            margin-top: 24px;
        }
        .z4{
            margin-bottom: 24px;
        }
        .fu{
            background-color: red;
            overflow: hidden;
        }
        .z3{
            margin: 24px;
            margin: 24px 30px;
            margin: 24px 30px 50px;
            margin: 24px 30px 50px 60px;
            /*实现代码块元素自身的水平居中 auto会自动将元素的左右外间距计算成相等的值*/
            margin: 0 auto;

        }
        span {
            border: 2px solid #f00;
        }
        .s2 {
            margin: 30px;
        }
    </style>
</head>
<body>
<span>span1</span><span class="s2">span2</span><span>span3</span>
    <div class="fu">
        <div class="z1">子元素1</div>
        <div class="z2">子元素2</div>
        <div class="z3">子元素3</div>
        <div class="z4">子元素4</div>
    </div>

</body>
</html>